package 引用;

import java.lang.ref.WeakReference;

/**
 * @author:谢君臣
 * @Date:2021/10/2-23:03
 * @version:1.0
 * @function:
 */
public class 弱引用 {
    public static void main(String[] args) throws InterruptedException {
        WeakReference<Source> reference = new WeakReference<Source>(new Source());
        System.out.println(reference.get().value);
        System.gc();
        Thread.sleep(5000);
        System.out.println(reference.get());
    }
}
